package com.config;

import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;

import javax.sql.DataSource;

/**
 * @Package: com.config
 * @ClassName: transactionConfig
 * @Author: 小政同学    QQ:xiaozheng666888@qq.com
 * @CreateTime: 2020/10/21 17:32
 * @What_is_this_file_for: 配置事务管理器
 * @Description: 描述
 */
public class transactionConfig {
    /**
     * 用于创建事务管理对象
     * @param dataSource
     * @return
     */
    @Bean(name = "transactionManager")
    public PlatformTransactionManager createTransactionManager(/*@Qualifier("dataSource")*/ DataSource dataSource) {
        return new DataSourceTransactionManager(dataSource);
    }
}
